﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ParkingLot.Business.Entitys;

namespace ParkingLot.Utility.CollectionEntity
{
    public static class CollectionHelp
    {
        public static void SetBinding(this ComboBox comboBox, CommonCollection commonCollection)
        {
            comboBox.ValueMember = "ValueMember";
            comboBox.DisplayMember = "DisplayMember";
            comboBox.DataBindings.Add("SelectedValue", commonCollection,
             PropertyHelp.GetPropertyName<CommonCollection>(x => x.CurrentValue),false,DataSourceUpdateMode.OnPropertyChanged);
            comboBox.DataSource = commonCollection.Sources;
        }

    }
}
